Skip to content

Validate AVE record string formats - #130

Merged
chaksaray merged 1 commit into
aveproject:mainfrom
mmaxjr:fix/record-format-checker
Aug 6, 2026
Merged

Validate AVE record string formats#130
chaksaray merged 1 commit into
aveproject:mainfrom
mmaxjr:fix/record-format-checker

Conversation

@mmaxjr

@mmaxjr mmaxjr commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • enable Draft202012Validator format checking in scripts/validate_records.py
  • add rfc3339-validator as a dev dependency so date-time formats are actually enforced
  • add regression coverage for malformed record published metadata

Root cause

validate_records.py built Draft202012Validator(schema) without a format checker. Adding FORMAT_CHECKER alone registers uri because rfc3986-validator is already present, but this environment showed date-time was still not registered until rfc3339-validator was installed.

Closes #125.

Verification

  • python -m pytest -q -> 281 passed
  • python scripts/validate_records.py -> all 70 records valid
  • python scripts/validate_crosswalks.py -> 4/4 crosswalks valid
  • python -m py_compile scripts/validate_records.py tests/test_validate_data.py -> passed

@chaksaray

Copy link
Copy Markdown
Contributor

This is an excellent first PR, and worth being direct about why: it doesn't just implement what #125 asked for, it corrects something #125 itself got wrong. That issue assumed rfc3986-validator was sufficient, reasoning from the crosswalk schema's date format check in #121, but that was scoped to a different format string than the record schema's date-time. Catching that rfc3986-validator alone doesn't cover it, and that rfc3339-validator specifically is the missing piece, is the kind of thing that only comes from actually running the check rather than assuming an adjacent finding transfers. Good catch, genuinely.

Traced the diff directly: build_validator() is a clean, purposeful extraction, it's what makes the regression test possible at all rather than being buried in main(). The test itself is correctly targeted, a deliberately malformed date-time value, asserting the real error text contains it, not just that validation fails for some reason. AVE-2026-99999 as the fixture ID is a sensible, safely non-colliding choice.

All 70 real records still passing is the right thing to have checked, confirms no regression against the actual corpus, not just a clean test in isolation. Appreciate you checking the crosswalk validator too even though this PR doesn't touch it.

Merging. And updating #125's own body to correct the dependency assumption, since it was wrong and this PR is the reason we now know that.

@chaksaray

Copy link
Copy Markdown
Contributor

hello @mmaxjr , please check the failed workflow on the test. once it fixed, we can merge.

@chaksaray
chaksaray merged commit acf1db6 into aveproject:main Aug 6, 2026
2 of 8 checks passed
chaksaray added a commit that referenced this pull request Aug 6, 2026
…st_validate_data.py

PR #130 added tests/test_validate_data.py with 'from scripts import
validate_records'. scripts/ deliberately has no __init__.py (this repo
isn't a package, see the packages = [] note in pyproject.toml). That
import resolves fine under 'python -m pytest' (which inserts cwd onto
sys.path), the exact command PR #130's own verification section used,
but CI's actual invocation is bare 'pytest tests/ -x -q'
(.github/workflows/tests.yml), which does not.

Confirmed directly: PR #130's merge commit has no tests.yml check run
recorded at all, only CodeQL/dependency-graph, so this was never
actually verified against CI's real invocation before merging.

Fix: pythonpath = ['.'] under [tool.pytest.ini_options], the standard
pytest 7+ mechanism for exactly this case. Verified with the literal
CI command: pytest tests/ -x -q -> 293 passed.
@chaksaray chaksaray mentioned this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

validate_records.py builds its validator without a format checker

2 participants